<template>
	<view>
		<up-cell  :title="item.label" >
			<template #right-icon>
				<text class="iconfont icon-bofang-full" @click="playaudo"></text>
			</template>
		</up-cell>
	</view>
	<view class="translate">
		 <up-tabs :list="list1" :current="current" ></up-tabs>
		<view>
			<view style="padding: 0 15px;margin-top: 10px;">
				<text class="text-gray font-11" style="font-style: italic;margin-right: 10px;">n.</text>
				<text class="font-13 " style="font-weight: 600;color: #000;">
					{{item.fanyi}}
				</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app'
	import {ref} from 'vue';
	import {toast} from 'luoyu-uni-utils'
	const  item=ref({})
	const current = ref(0)
	const list1 = ref([
		 { name: '简明' },  
	])
	
	onLoad((query)=>{
		console.log(query);
		item.value = uni.getStorageSync('words-query')
		console.log(item.value);
		
	})
	
	function playaudo(){
		//创建音频播放器 使用uniapp内置对象创建音频播放器
		const innerAudioContext = uni.createInnerAudioContext()
		//设置开始播放
		console.log(item.value)
		innerAudioContext.autoplay = true
		//设置音频播放的路径
		innerAudioContext.src =item.value.value
		//播放的监听事件
		innerAudioContext.onPlay(() => {
			console.log('开始播放了');
		})
		innerAudioContext.onError(() =>{
			toast("音频损坏！")
		})
	}
	
</script>

<style>
</style>